import {getCounsumeList, getOrderList} from "../../api/api";

Page({
  data: {
    records: [],
    search: {
      pageNum: 1,
      pageSize: 10
    },
    total: 0
  },

  onLoad() {
    this.getData();
  },

  getData() {
    getCounsumeList(this.data.search).then(res => {
      let records = this.data.records;
      records = records.concat(res.rows);
      this.setData({
        records: records,
        total: res.total
      });
    });
  },

  scrolltolower() {
    if (this.data.records.length >= this.data.total) {
      return;
    }
    this.setData({
      'search.pageNum': this.data.search.pageNum + 1
    });
    this.getData();
  }
})